#ifndef IHTTPCLIENT_H
#define IHTTPCLIENT_H


#define UNUSED_PARAMETER(p)     ((void)p)


#if defined(_MSC_VER) && (_MSC_VER>=1400)
#pragma warning(disable: 4996)
#endif


/**
 * This interface is used to dynamically implement a http client for retrieving remote files
 * It acts as a wrapper for libcurl/Qt.
 *
 * @author gonwan(gonwan@gmail.com)
 * @version 2.0
 */
class IHttpClient
{
public:
    /** Default timeout value */
    const static int HC_TIMEOUT = 10*1000;
    /**
     * This function sets the proxy settings of the client
     * @param szServer The address of proxy
     * @param iPort The port of proxy
     * @param szUser The user name of authentication if needed
     * @param szPassword The password of authentication if needed
     * @param szDomain The Domain of authentication if needed
     * @return true if success
     */
    virtual bool setProxy(/*in*/ const char *szServer, /*in*/ const int iPort,
        /*in*/ const char *szUser = 0, /*in*/ const char *szPassword = 0, /*in*/ const char* szDomain = 0) = 0;
    /**
     * This function get the resource specified and keep it just in memory
     * @param szUrl The given Url of resource
     * @param szBuffer The memory buffer, it should be free manually
     * @return true if success
     */
    virtual bool getUrlToMem(/*in*/ const char *szUrl, /*out*/ char *szBuffer) = 0;
    /**
     * This function get the resource specified and save it to a local file
     * @param szUrl The given Url of resource
     * @param szLocalFilePath The local file path to save
     * @return true if success
     */
    virtual bool getUrlToFile(/*in*/ const char *szUrl, /*in*/ const char *szLocalFilePath) = 0;
    /**
     * This function release the instance
     * It is here to simplify the delete sequence of sub-classes.
     */
    virtual void release() = 0;

};


#endif
